﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Types.aspx.cs" Inherits="Sinacor.Infra.Tools.ServiceRegistration.Web.Types" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Cadastro de Tipos</title>
    <link href="../StyleSheet.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManagerType" runat="server" />
        <asp:UpdatePanel ID="UpdatePanelType" runat="server">
            <ContentTemplate>
                <table align="left" cellpadding="10" cellspacing="10" border="0" class="table">
                    <tr style="height: 10%">
                        <td class="boder">
                            <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                <tr>
                                    <td style="width: 200;" class="title">NameSpace</td>
                                    <td style="width: 200;" class="title">Tipo</td>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:TextBox ID="txtNameSpace" runat="server" Width="200"></asp:TextBox>                                        
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtType" runat="server" Width="200"></asp:TextBox>
                                    </td>
                                    <td>
                                        <asp:Button ID="btnClear" runat="server" Text="Limpar" Width="100" Style="vertical-align: top" OnClick="btnClear_Click" />
                                        <asp:Button ID="btnSearch" runat="server" Text="Pesquisar" Width="100" Style="vertical-align: top" OnClick="btnSearch_Click" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr style="height: 80%">
                        <td class="boder" style="vertical-align: top;">
                            <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                <tr>
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                                        <tr>
                                                            <td style="width: 200;" class="title">NameSpace</td>
                                                            <td style="width: 200;" class="title">Tipo</td>
                                                            <td>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:TextBox ID="txtNameSpaceEdit" runat="server" Width="200"></asp:TextBox>                                                                
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtTTypeEdit" runat="server" Width="200"></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvTxtTTypeEdit" runat="server" ControlToValidate="txtTTypeEdit" ErrorMessage="Favor informar o nome do tipo" SetFocusOnError="True" Display="None" ValidationGroup="Type" ></asp:RequiredFieldValidator>
                                                                <input id="txtTypeIdEdit" type="hidden" runat="server" />
                                                                <input id="txtParentTypeIdEdit" type="hidden" runat="server" />
                                                            </td>
                                                            <td style="text-align: right; vertical-align: middle;">
                                                                <asp:Button ID="btnSaveType" runat="server" Text="Salvar" Width="80" OnClick="btnSave_Click" ValidationGroup="Type" />
                                                                <asp:Button ID="btnNewType" runat="server" Text="Novo" Width="80" OnClick="btnNew_Click" CausesValidation="false"/>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 20px;">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:GridView ID="gdvType" DataKeyNames="TypeId" PageSize="15"
                                                        AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                        BorderStyle="None" Width="95%" CellPadding="2" BorderWidth="0" 
                                                        OnRowDeleting="gdvType_RowDeleting" OnRowCreated="gdvType_RowCreated" 
                                                        OnPageIndexChanging="gdvType_PageIndexChanging">
                                                        <Columns>
                                                            <asp:BoundField DataField="TypeId" HeaderText="TypeId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="ParentTypeId" HeaderText="ParentTypeId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="TypeName" HeaderText="TypeName" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="Namespace" HeaderText="Namespace" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:TemplateField HeaderText="Tipo" ItemStyle-Width="100%">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblTypegdvType" runat="server" Text='<%# Eval("FullTypeName") %>' Width="95%"></asp:Label>
                                                                </ItemTemplate>
                                                                <EditItemTemplate>
                                                                    <asp:TextBox ID="txtTypegdvType" runat="server" Text='<%# Bind("FullTypeName") %>' Width="95%"></asp:TextBox>
                                                                </EditItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton id="imgSearchParentType" runat="server" ImageUrl="../images/reticencias.gif" alt="" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                        <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                        <EmptyDataTemplate>
                                                            <p style="text-align: center; font-weight: bold;">
                                                                <asp:Label ID="lblItensgdvType" runat="server" Text="Label">Não há Tipos Cadastrados.</asp:Label>
                                                            </p>
                                                        </EmptyDataTemplate>
                                                    </asp:GridView>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
